import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'login',
    component: () => import('../views/login/Login.vue')
  },
  {
    path: '/index',
    name: 'index',
    component: () => import('../views/Index.vue'),
    redirect: '/main',
    children: [
      {
        path: '/main',
        name: 'main',
        component: () => import('../components/common/Main.vue')
      },
      {
        path: '/info',
        name: 'info',
        component: () => import('../components/info/Info.vue')
      },

    ]
  }

]

const router = new VueRouter({
  //mode: 'history',
  routes
})

/*export function resetRouter() {
  router.matcher = new VueRouter({
    mode: 'history',
    routes: []
  }).matcher
}*/

/*const VueRouterPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(to) {
  return VueRouterPush.call(this, to).catch(err => err)
}*/


export default router
